package com.clouddms.service.transfer;

/**
 * 上传状态枚举
 * 
 * @author Cloud-DMS Team
 * @version 1.0.0
 */
public enum UploadStatus {
    INITIALIZED("已初始化", "#007bff"),
    UPLOADING("上传中", "#28a745"),
    PAUSED("已暂停", "#ffc107"),
    MERGING("合并中", "#17a2b8"),
    COMPLETED("已完成", "#28a745"),
    FAILED("失败", "#dc3545"),
    CANCELLED("已取消", "#6c757d");

    private final String displayName;
    private final String color;

    UploadStatus(String displayName, String color) {
        this.displayName = displayName;
        this.color = color;
    }

    public String getDisplayName() {
        return displayName;
    }

    public String getColor() {
        return color;
    }

    /**
     * 检查是否为活跃状态（正在进行中）
     */
    public boolean isActive() {
        return this == UPLOADING || this == MERGING;
    }

    /**
     * 检查是否为终止状态
     */
    public boolean isTerminal() {
        return this == COMPLETED || this == FAILED || this == CANCELLED;
    }

    /**
     * 检查是否可以恢复
     */
    public boolean canResume() {
        return this == PAUSED || this == FAILED;
    }

    /**
     * 检查是否可以取消
     */
    public boolean canCancel() {
        return this == INITIALIZED || this == UPLOADING || this == PAUSED;
    }
}